home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form frmSpin
- BackColor = &H00C0C0C0&
- BorderStyle = 3 'Fixed Double
- Caption = "Spin Button Demo"
- ClientHeight = 2205
- ClientLeft = 1500
- ClientTop = 2475
- ClientWidth = 4710
- ClipControls = 0 'False
- Height = 2610
- Icon = 0
- Left = 1440
- LinkTopic = "Form1"
- ScaleHeight = 2205
- ScaleWidth = 4710
- Top = 2130
- Width = 4830
- Begin CUAEdit CUAEdit1
- BorderStyle = 3 'Inset
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 285
- Left = 3510
- TabIndex = 16
- Top = 1740
- Width = 315
- End
- Begin CUASpin CUASpin1
- Buddy = "CUAEdit1"
- Height = 285
- Left = 3840
- TabIndex = 15
- Top = 1740
- Width = 195
- End
- Begin CUACommand cmdOK
- Caption = "OK"
- Default = -1 'True
- Height = 345
- Left = 3315
- StandardButton = 1 'OK
- TabIndex = 1
- Top = 120
- Width = 1260
- End
- Begin CUAFrame grp2
- BackColor = &H00C0C0C0&
- BorderStyle = 5 'Dip
- Caption = "Date and time"
- Height = 840
- Left = 165
- TabIndex = 2
- Top = 735
- Width = 4155
- Begin CUASpin spnTime
- Height = 285
- Index = 0
- Left = 2520
- Max = 23
- TabIndex = 4
- Top = 300
- Width = 195
- Wrap = -1 'True
- End
- Begin CUASpin spnTime
- Height = 285
- Index = 1
- Left = 3105
- Max = 59
- TabIndex = 6
- Top = 300
- Width = 195
- Wrap = -1 'True
- End
- Begin CUASpin spnTime
- Height = 285
- Index = 2
- Left = 3690
- Max = 59
- TabIndex = 8
- Top = 300
- Width = 195
- Wrap = -1 'True
- End
- Begin CUAEdit txtTime
- BorderStyle = 3 'Inset
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 285
- Index = 0
- Left = 2175
- TabIndex = 3
- Text = "00"
- Top = 300
- Width = 330
- End
- Begin CUAEdit txtTime
- BorderStyle = 3 'Inset
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 285
- Index = 1
- Left = 2760
- TabIndex = 5
- Text = "00"
- Top = 300
- Width = 330
- End
- Begin CUAEdit txtTime
- BorderStyle = 3 'Inset
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 285
- Index = 2
- Left = 3345
- TabIndex = 7
- Text = "00"
- Top = 300
- Width = 330
- End
- Begin CUAEdit txtDate
- BorderStyle = 3 'Inset
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 285
- Index = 0
- Left = 120
- TabIndex = 9
- Text = "94"
- Top = 315
- Width = 330
- End
- Begin CUASpin spnDate
- Height = 285
- Index = 0
- Left = 465
- Max = 99
- TabIndex = 10
- Top = 315
- Width = 195
- Wrap = -1 'True
- End
- Begin CUAEdit txtDate
- BorderStyle = 3 'Inset
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 285
- Index = 1
- Left = 705
- TabIndex = 11
- Text = "01"
- Top = 315
- Width = 330
- End
- Begin CUASpin spnDate
- Height = 285
- Index = 1
- Left = 1050
- Max = 12
- Min = 1
- TabIndex = 12
- Top = 315
- Width = 195
- Wrap = -1 'True
- End
- Begin CUAEdit txtDate
- BorderStyle = 3 'Inset
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 285
- Index = 2
- Left = 1290
- TabIndex = 13
- Text = "20"
- Top = 315
- Width = 330
- End
- Begin CUASpin spnDate
- Height = 285
- Index = 2
- Left = 1635
- Max = 31
- Min = 1
- TabIndex = 14
- Top = 315
- Width = 195
- Wrap = -1 'True
- End
- End
- Begin Timer Timer1
- Interval = 1000
- Left = 4350
- Top = 675
- End
- Begin CUALabel lbl
- Caption = "It can easily be connected with other controls, using the 'Buddy' property:"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00000080&
- Height = 450
- Index = 0
- Left = 180
- TabIndex = 17
- Top = 1665
- Width = 3105
- End
- Begin CUALabel lbl
- Caption = "Spin buttons are used in conjunction with other components, to increase/decrease a value in the ""buddy"" component."
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00000080&
- Height = 615
- Index = 6
- Left = 180
- TabIndex = 0
- Top = 120
- Width = 3000
- End
- Option Explicit
- Dim TimeDateHasFocus As Integer
- Sub cmdOK_Click ()
- Unload Me
- End Sub
- Sub spnDate_Change (Index As Integer)
- txtDate(Index) = Format$(spnDate(Index), "00")
- End Sub
- Sub spnTime_Change (Index As Integer)
- txtTime(Index) = Format$(spnTime(Index), "00")
- End Sub
- Sub Timer1_Timer ()
- Dim D
- If TimeDateHasFocus Then Exit Sub
- D = Now
- spnTime(0) = Hour(D)
- spnTime(1) = Minute(D)
- spnTime(2) = Second(D)
- spnDate(0) = Year(D) - 1900
- spnDate(1) = Month(D)
- spnDate(2) = Day(D)
- End Sub
- Sub txtDate_GotFocus (Index As Integer)
- TimeDateHasFocus = True
- End Sub
- Sub txtDate_LostFocus (Index As Integer)
- TimeDateHasFocus = False
- End Sub
- Sub txtTime_GotFocus (Index As Integer)
- TimeDateHasFocus = True
- End Sub
- Sub txtTime_LostFocus (Index As Integer)
- TimeDateHasFocus = False
- End Sub
-